<!DOCTYPE html>
<html lang="{{.Lang}}">
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
	<meta http-equiv="X-UA-Compatible" content="IE=edge"/>
	<meta name="viewport" content="width=device-width,user-scalable=no"/>
	<meta name="format-detection" content="telephone=no"/>
	<meta name="renderer" content="webkit"/>
	<meta name="wap-font-scale" content="no"/>
	<title>{{.Path}}</title>
	<link rel="stylesheet" type="text/css" href="{{.RootRelPath}}?asset=index.css"/>
</head>
<body class="{{if .IsRoot}}root-dir{{else}}sub-dir{{end}}">
{{$contextQueryString := .Context.QueryString}}
{{$isDownload := .IsDownload}}
{{$SubItemPrefix := .SubItemPrefix}}
{{$canSelect := or .CanArchive .CanDelete}}
{{if not $isDownload}}
<ol class="path-list" translate="no">
	{{range .Paths}}
	<li><a href="{{.Path}}{{$contextQueryString}}">{{fmtFilename .Name}}</a></li>
	{{end}}
</ol>

{{if .CanMkdir}}
<div class="panel mkdir">
	<form method="POST" action="{{.SubItemPrefix}}?mkdir">
		<input type="text" autocomplete="off" name="name" class="name"/>
		<input type="submit" value="{{.Trans.MkdirLabel}}" class="submit"/>
	</form>
</div>
{{end}}

{{if .CanUpload}}
<div class="tab upload-type">
	<label class="file active" tabindex="0" role="button" title="{{.Trans.UploadFilesHint}}">{{.Trans.UploadFilesLabel}}</label>
	{{if .CanMkdir}}<label class="dirfile hidden" tabindex="0" role="button" title="{{.Trans.UploadDirHint}}">{{.Trans.UploadDirLabel}}</label>{{end}}
	<label class="innerdirfile hidden" tabindex="0" role="button" title="{{.Trans.UploadDirContentsHint}}">{{.Trans.UploadDirContentsLabel}}</label>
</div>
<div class="panel upload">
	<form method="POST" action="{{.SubItemPrefix}}?upload" enctype="multipart/form-data">
		<input type="file" name="file" multiple="multiple" class="file"/>
		<button type="submit" class="submit">
			<span class="progress"></span>
			<span class="if-enabled">{{.Trans.UploadLabel}}</span><span class="if-disabled">{{.Trans.UploadingLabel}}</span>
		</button>
	</form>
</div>
{{end}}

{{if .SubItemsHtml}}
<div class="panel filter" id="panel-filter">
	<div class="form">
		<input type="text" accesskey="r" placeholder="{{.Trans.FilterLabel}}"/>
		<button type="reset">X</button>
	</div>
</div>
{{end}}

{{if .CanDelete}}
<script type="text/javascript">
	function confirmDelete() {
		return confirm('{{.Trans.DeleteConfirm}}');
	}
</script>
{{end}}
{{end}}
<form method="POST" class="item-list-action">
{{if $canSelect}}
<div class="panel actions">
	<div class="action-list">
		{{if .CanArchive}}
		<button class="archive" title="{{.Trans.ArchiveLabel}}" formaction="{{.SubItemPrefix}}?tgz">.tgz</button>
		<button class="archive" title="{{.Trans.ArchiveLabel}}" formaction="{{.SubItemPrefix}}?zip">.zip</button>
		{{end}}
		{{if  .HasDeletable}}
		<button class="need-select delete" title="{{.Trans.DeleteLabel}}" formaction="{{.SubItemPrefix}}?delete">X</button>
		{{end}}
	</div>
	<div class="action-switch">
		<button class="start-select">{{.Trans.SelectStart}}</button>
		<button class="cancel-select" type="reset">{{.Trans.SelectCancel}}</button>
	</div>
</div>
{{end}}
<ul class="item-list{{if $canSelect}} can-select{{end}}">
	{{if not .IsDownload}}
	<li class="header">{{$dirSort := .SortState.DirSort}}{{$sortKey := .SortState.Key}}
		{{if $canSelect}}<label class="select" title="{{.Trans.SelectAll}}"><input type="checkbox" class="select-all" /></label>{{end}}
		<span class="detail">
		<a class="field dir" href="{{.SubItemPrefix}}{{.Context.QueryStringOfSort .SortState.NextDirSort}}">{{.Trans.ListDirLabel}}{{if eq $dirSort -1}}&uarr;{{else if eq $dirSort 1}}&darr;{{end}}</a>
		<a class="field name" href="{{.SubItemPrefix}}{{.Context.QueryStringOfSort .SortState.NextNameSort}}">{{.Trans.ListNameLabel}}{{if eq $sortKey "n"}}&uarr;{{else if eq $sortKey "N"}}&darr;{{end}}</a>
		<a class="field type" href="{{.SubItemPrefix}}{{.Context.QueryStringOfSort .SortState.NextTypeSort}}">{{.Trans.ListTypeLabel}}{{if eq $sortKey "e"}}&uarr;{{else if eq $sortKey "E"}}&darr;{{end}}</a>
		<a class="field size" href="{{.SubItemPrefix}}{{.Context.QueryStringOfSort .SortState.NextSizeSort}}">{{.Trans.ListSizeLabel}}{{if eq $sortKey "s"}}&uarr;{{else if eq $sortKey "S"}}&darr;{{end}}</a>
		<a class="field time" href="{{.SubItemPrefix}}{{.Context.QueryStringOfSort .SortState.NextTimeSort}}">{{.Trans.ListTimeLabel}}{{if eq $sortKey "t"}}&uarr;{{else if eq $sortKey "T"}}&darr;{{end}}</a>
		</span>
	</li>
	<li class="parent">
		{{if $canSelect}}<label class="select"></label>{{end}}
		<a href="{{if .IsRoot}}./{{else}}../{{end}}{{$contextQueryString}}" class="detail">
			<span class="icon"></span>
			<span class="field name" translate="no">../</span>
			<span class="field size"></span>
			<span class="field time"></span>
		</a>
	</li>
	{{end}}
	{{$subItems := .SubItems}}
	{{range $i, $subItemHtml := .SubItemsHtml}}
	<li class="{{.Type}}">
		{{if $canSelect}}
		{{$subItem := index $subItems $i}}
		<label class="select"><input type="checkbox" name="name" value="{{$subItem.Name}}" /></label>
		{{end}}
		<a href="{{.Url}}" class="detail">
			<span class="icon"></span>
			<span class="field name" translate="no">{{.DisplayName}}</span>
			<span class="field size">{{.DisplaySize}}</span>
			<span class="field time">{{.DisplayTime}}</span>
		</a>
	</li>
	{{end}}
</ul>
</form>

{{if eq .Status 403}}
<div class="error">{{.Trans.Error403}}</div>
{{else if eq .Status 404}}
<div class="error">{{.Trans.Error404}}</div>
{{else if eq .Status 500}}
<div class="error">{{.Trans.Error500}}</div>
{{end}}

<script type="text/javascript" src="{{.RootRelPath}}?asset=index.js" defer="defer" async="async"></script>
</body>
</html>
